Add GitHub Action to suggest PR reviewers based on git history#4789
Merged
simonfaltum merged 4 commits intomainfrom Mar 18, 2026
Merged
Add GitHub Action to suggest PR reviewers based on git history#4789simonfaltum merged 4 commits intomainfrom
simonfaltum merged 4 commits intomainfrom
Conversation
Add a reviewer suggestion workflow that posts a PR comment with 1-2 suggested reviewers based on recency-weighted git history of changed files. This is additive only, CODEOWNERS and auto-assign stay unchanged. The action triggers on PR open and ready-for-review events, skips drafts and fork PRs, and updates its comment in-place on re-runs.
Use gh api to resolve commit SHAs to GitHub logins automatically, removing the need to maintain a manual author alias map. Also fix error handling for gh subprocess failures, replace hardcoded CODEOWNERS fallback with a link, add --since to bound git log, and add synchronize trigger so suggestions update on new pushes.
Switch to deco runner group (IP allow list). Add CODEOWNERS parsing to show eligible reviewers alongside the git-history-based suggestions. Expand from 1-2 to 1-3 suggested reviewers with 1.5x threshold.
Eligible reviewersCould not determine reviewers from git history. Based on CODEOWNERS, these people or teams could review: @andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka Suggestions based on git history of 2 changed files (0 scored). See CODEOWNERS for path-specific ownership rules. |
Collaborator
|
Commit: 81c87b9
20 interesting tests: 9 SKIP, 7 KNOWN, 4 flaky
Top 23 slowest tests (at least 2 minutes):
|
pietern
approved these changes
Mar 18, 2026
| GITHUB_REPOSITORY: ${{ github.repository }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | ||
| run: python3 tools/suggest_reviewers.py |
Contributor
There was a problem hiding this comment.
Nit: let's use uv here (and setup-uv) to make sure we really run with 3.12.
denik
reviewed
Mar 18, 2026
tools/suggest_reviewers.py
Outdated
| if p.name.startswith("out.") or p.name == "output.txt": | ||
| return 0.0 | ||
| if path.startswith(("cmd/workspace/", "cmd/account/")): | ||
| return 0.0 |
Contributor
There was a problem hiding this comment.
FYI, there are non-generated files as well in those directories.
renaudhartert-db
approved these changes
Mar 18, 2026
Contributor
renaudhartert-db
left a comment
There was a problem hiding this comment.
Can we port that to TF and SDKs?
Remove the 0.0 weight override for cmd/workspace/ and cmd/account/ since those directories contain non-generated files too (denik). Use uv + setup-uv to pin Python 3.12 (pietern).
Collaborator
|
Commit: a2e290d
46 interesting tests: 15 flaky, 14 RECOVERED, 9 KNOWN, 7 FAIL, 1 SKIP
Top 50 slowest tests (at least 2 minutes):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The CLI's CODEOWNERS catch-all assigns 6 people to every PR outside a few narrow paths. This creates review noise and diffuses responsibility. We want targeted reviewer suggestions based on who actually worked on the changed code recently.
Changes
Before: Every PR touching core code auto-assigns all 6 CODEOWNERS. No signal about who is best suited to review.
Now: A new GitHub Action analyzes git history of the changed files and posts a PR comment with two sections:
This is additive only. CODEOWNERS and auto-assign stay unchanged.
How it works:
.github/CODEOWNERSto find eligible reviewers for the changed pathsImplementation: a single Python script (
tools/suggest_reviewers.py, 281 lines) and a minimal workflow YAML.Test plan
make checks, passedruff formatPR #4784 (66 files, by pietern, big DABs rename):
Correctly identifies Denis as the clear top reviewer (2x second place score). All 6 CODEOWNERS shown as eligible.
PR #4782 (13 files, by denik, bundle engine priority):
Suggests 3 reviewers when scores are close. Remaining CODEOWNERS shown as eligible.
PR #4785 (2 files, by MarioCadenas, apps bug fix):
Correctly suggests apps-area contributors (not the catch-all CODEOWNERS). Shows the apps team as eligible. Low confidence since only 2 files.
PR #4774 (28 files, by denik, direct engine grants):
Correctly identifies the two main bundle/direct contributors. High confidence with clear score separation.